package org.chiv.gof.proxy;

/**
 * 代理模式
 * <p>
 * 地产中介
 */
public class EstateAgents {

    //楼盘接口
    interface Room {
        void showPrice();
    }

    static class GZRoom implements Room {

        public void showPrice() {
            System.out.println("GZRoom楼盘每平方10000");
        }
    }

    /**
     * 良心中介
     */
    static class ProxyEstate implements Room {
        private GZRoom Room = new GZRoom();

        public void showPrice() {
            pre();
            Room.showPrice();
            after();
        }

        private void pre() {
            System.out.println("需找最便宜的楼盘");
        }

        private void after() {
            System.out.println("获取到报价后，升价每平方11000");
        }
    }

    public static void main(String[] args) {
        ProxyEstate proxyEstate = new ProxyEstate();
        proxyEstate.showPrice();

    }
}
